#-*- coding: utf-8 -*
#@author 小测试
#@create 2020-03-15 11:30
"""
用例的公共方法
例如:登录
"""
from ApiDemo.util.tools.open_ini import Config
from ApiDemo.util.get_log import MyLog
import pytest
import requests
import json

log=MyLog()
@pytest.fixture(scope="session")
def login():
    url=Config().loginHost_test
    data=eval(Config().loginData_test)
    head={
        "Content-Type":"application/json"
    }
    data=json.dumps(data)
    res=requests.post(url=url,headers=head,data=data)
    token=res.json()["data"]["token"]
    log.debug("Token获取成功:{}".format(token))
    return token

if __name__ == '__main__':
    login()
